set flagD D
set flagA A
set defchanmodes {
            -clearbans
            +enforcebans      
            +dynamicbans
            +userbans
            -autoop
            -bitch
            +greet
            -protectops
            +statuslog
            +stopnethack
            -revenge
            +autovoice
            -secret
            -shared
            -cycle
        }

#######
#BINDS#
#######

unbind dcc o|o say *dcc:say
unbind dcc o|- msg *dcc:msg
bind dcc o|n say *dcc:say
bind dcc o msg *dcc:msg
bind pub - $nick otbn.kernal
bind pub - $altnick otbn.kernal
bind pub - $easykey otbn.kernal
bind pub o $easybotnet otbn.kernal
bind mode -o "% -o" deoped
#AbO
bind msg - login auth
bind msg - auth auth
bind sign A * logout
bind pubm - * mscomicwarn
bind kick - * kickwarn
bind bot - auth globauth
#AbO
bind bot - login globauth


bind msg - version msg:version
bind msg - credits msg:credits
bind msg - commands msg:commands
bind msg - access msg:access
bind msg - banlist msg:banlist
# Added by OTTech
bind msg - listbans msg:banlist 
bind msg - userlist msg:userlist
# Added by OTTech
bind msg - listusers msg:userlist 
bind msg - help msg:help 
bind msg - admin msg:admin
bind msg - voice msg:voice
bind msg - devoice msg:devoice
bind msg - comment msg:comment
#AbO
bind msg - sendnote msg:sndnote
bind msg - sndnote msg:sndnote
bind msg - topic msg:topic
bind msg - op msg:op
bind msg - deop msg:deop
bind msg - kick msg:kick
bind msg - ban msg:ban
bind msg - unban msg:unban
bind msg - invite msg:invite
bind msg - usermod msg:usermod
bind msg - killmodes msg:killmodes
# Added by OTTech
bind msg - remuser msg:userdel 
# Added by OTTech
bind msg - deluser msg:userdel 
bind msg - userdel msg:userdel
# Added by OTTech
bind msg - adduser msg:useradd 
bind msg - useradd msg:useradd
bind msg - mode msg:mode
bind msg - say msg:say
bind msg - act msg:act
bind msg - chanstats msg:chanstats
# Added by OTTech
bind msg - chans msg:chans 
bind msg - addchan msg:addchan
# Added by OTTech
bind msg - chanadd msg:addchan
#Abo
#bind msg - join msg:addchan
bind msg - remchan msg:remchan
# Added by OTTech
bind msg - chandel msg:remchan 
# Added by OTTech
bind msg - delchan msg:remchan 
# Added by OTTech
#bind msg - part msg:remchan 
#AbO
bind msg - global msg:broadcast
bind msg - broadcast msg:broadcast
bind msg - disable msg:disable
# Added by OTTech
bind msg - suspend msg:disable 
bind msg - enable msg:enable
# Added by OTTech
bind msg - unsuspend msg:enable 
bind msg - save msg:save
bind msg - rehash msg:rehash
bind msg - restart msg:restart
#AbO
bind msg - sendmsg msg:sndmsg
bind msg - sndmsg msg:sndmsg
#AbO
bind msg - sendnotice msg:sndnotice
bind msg - sndnotice msg:sndnotice
bind msg - servers msg:servers
#AbO
bind msg - shutdown msg:core
#AbO
bind msg - die msg:core
bind msg - core msg:core

proc otbn.kernal {nick host handle chan arg} {
global home botnick defchanoptions defchanmodes
  set defchanoptions {
  chanmode "+nt"
  idle-kick 0 
  need-op { } 
  need-invite { } 
  need-key { } 
  need-unban { } 
  need-limit { } 
  flood-chan 20:60 
  flood-deop 3:10 
  flood-kick 3:10
  flood-join 10:60 
  flood-ctcp 3:60
  }
  set defchanmodes {
  -clearbans 
  +enforcebans 
  +dynamicbans 
  +userbans 
  -autoop 
  -bitch 
  +greet 
  -protectops 
  +statuslog 
  +stopnethack 
  -revenge 
  +autovoice 
  -secret 
  -shared 
  +cycle
  }
  set hitkey [string tolower [lindex $arg 0]]
if {[string match "#*" $chan] && ([string match {addchan} $hitkey] == 1)} {
if {[validchan $chan]} {			
  set otbn1 [lindex $arg 1]
  set otbn [lindex $arg 3]
  set tcl [lindex $arg 4]
  set botnet [lrange $arg 2 end]
  set botnet2 [lrange $arg 3 end]
  set botnet3 [lrange $arg 4 end]
  } else {
  putserv "NOTICE $nick :$chan is not a registered channel."
  return 0
  }
  } else {
if {([string match "*#*" $arg]) && (![string match "*remchan*" $arg])} {
  set chan [lindex $arg 1]
  set otbn1 [lindex $arg 2]
  set otbn [lindex $arg 3]
  set tcl [lindex $arg 4]
  set botnet [lrange $arg 2 end]
  set botnet2 [lrange $arg 3 end]
  set botnet3 [lrange $arg 4 end]		
  } else {		
  set otbn1 [lindex $arg 1]
  set otbn [lindex $arg 2]
  set tcl [lindex $arg 3]
  set botnet [lrange $arg 1 end]
  set botnet2 [lrange $arg 2 end]
  set botnet3 [lrange $arg 3 end]
  } 
  }	
if {[string match {version} $hitkey] == 1} {
  version $nick $host
  return 0
  }
if {[string match {credits} $hitkey] == 1} {
  credits $nick $host
  return 0
  }
if {[string match {commands} $hitkey] == 1} {
  commands $nick $handle $chan $otbn1 $host
  return 0
  }
if {[string match {access} $hitkey] == 1} {	
  do_access $nick $chan $otbn1 $host
  return 0
  }
#AbO
if {[string match {listbans} $hitkey] == 1} {	
  do_banlist $nick $chan $host
  return 0
  }
if {[string match {banlist} $hitkey] == 1} {	
  do_banlist $nick $chan $host
  return 0
  }
if {[string match {userlist} $hitkey] == 1} {
  do_userlist $nick $chan $host $otbn1 
  return 0
  }
if {[string match {help} $hitkey] == 1} {
  help $nick $otbn1 $chan $host
  return 0
  } 
if {[string match {admin} $hitkey] == 1} {
  admin $nick $host
  return 0
  }     
if {![matchattr $handle o|v $chan] && ![matchattr $handle o|o $chan]} {
  putserv "NOTICE $nick :Permission denied."
  return 0
  }
if {[matchattr $handle D]} {
  putserv "NOTICE $nick :Permission denied: Your user account is disabled."
  return 0
  }
if {![matchattr $handle A]} {
  putserv "NOTICE $nick :Permission denied: Your not authenticated."           
  putserv "NOTICE $nick :You may authenticate yourself by typing /msg $botnick auth <your password>"
  return 0
  }
if {[string match {voice} $hitkey] == 1} {
  voice $nick $handle $chan $otbn1 $host $botnet
  return 0
  }
if {[string match {devoice} $hitkey] == 1} {
  devoice $nick $handle $chan $otbn1 $host $botnet
  return 0
  }       
if {[string match {comment} $hitkey] == 1} {
  comment $nick $handle $host $chan $otbn1 $botnet
  return 0 
  }
#AbO
if {[string match {sendnote} $hitkey] == 1} {
  sndnote $nick $handle $otbn1 $botnet2 $host $chan	
  return 0
  }
if {[string match {sndnote} $hitkey] == 1} {
  sndnote $nick $handle $otbn1 $botnet2 $host $chan	
  return 0
  }
if {![matchattr $handle o|o $chan]} {
  putserv "NOTICE $nick :Permission denied."
  return 0
  }
if {[string match {topic} $hitkey] == 1} {
  pub_topic $nick $chan $botnet $host
  return 0
  }
if {[string match {op} $hitkey] == 1} {
  op $nick $chan $otbn1 $host $botnet
  return 0       
  }
if {[string match {deop} $hitkey] == 1} {
  deop $nick $chan $host $otbn1 $botnet $handle
  return 0
  }
if {[string match {kick} $hitkey] == 1} {
  kick $nick $handle $chan $host $otbn1 $botnet2
  return 0
  }
if {[string match {ban} $hitkey] == 1} {
  ban $nick $handle $chan $otbn1 $otbn $botnet2 $botnet3 $host 
  return 0
  }
if {[string match {unban} $hitkey] == 1} {
  unban $nick $handle $chan $otbn1 $host
  return 0
  }
if {[string match {invite} $hitkey] == 1} {
  invite $nick $handle $host $chan $otbn1
  return 0
  }
if {![matchattr $handle o|m $chan]} {
  putserv "NOTICE $nick :Permission Denied."
  return 0
  }
if {[string match {usermod} $hitkey] == 1} {
  usermod $nick $handle $chan $otbn1 $otbn $tcl $host
  return 0
  }
if {[string match {killmodes} $hitkey] == 1} {
  killmodes $nick $chan $host
  return 0
  }
if {[string match {userdel} $hitkey] == 1} {
  userdel $nick $handle $chan $otbn1 $otbn $host
  return 0	
  }
#AbO
if {[string match {deluser} $hitkey] == 1} { 
  userdel $nick $handle $chan $otbn1 $otbn $host
  return 0	
  }
#AbO
if {[string match {remuser} $hitkey] == 1} {
  userdel $nick $handle $chan $otbn1 $otbn $host
  return 0	
  }
#AbO
if {[string match {adduser} $hitkey] == 1} {
  useradd $nick $handle $chan $otbn1 $host $otbn $tcl
  return 0
  }
if {[string match {useradd} $hitkey] == 1} {
  useradd $nick $handle $chan $otbn1 $host $otbn $tcl
  return 0
  }
if {[string match {mode} $hitkey] == 1} {
  mode $nick $chan $botnet $host
  return 0
  }
if {![matchattr $handle o|n $chan]} {
  putserv "NOTICE $nick :Permission Denied."
  return 0
  }
if {[string match {say} $hitkey] == 1} {
  say $nick $chan $botnet $host
  return 0
  }      
if {[string match {act} $hitkey] == 1} {
  act $nick $chan $host $botnet
  return 0
  }
if {![matchattr $handle o]} {
  putserv "NOTICE $nick :Permission Denied."
  return 0
  }
#AbO
if {[string match {chans} $hitkey] == 1} {
  chanstats $nick $host
  return 0
  }
if {[string match {chanstats} $hitkey] == 1} {
  chanstats $nick $host
  return 0
  }
#AbO
if {[string match {chanadd} $hitkey] == 1} {
  addchan $nick $otbn1 $host $handle
  return 0
  }
#AbO - not work, probably conflicting with another script
#if {[string match {join} $hitkey] == 1} {
#  addchan $nick $otbn1 $host $handle
#  return 0
#  }
if {[string match {addchan} $hitkey] == 1} {
  addchan $nick $otbn1 $host $handle
  return 0
  }
if {[string match {remchan} $hitkey] == 1} {
  remchan $nick $chan $otbn1 $handle $host
  return 0
  }
#Abo
if {[string match {delchan} $hitkey] == 1} {
  remchan $nick $chan $otbn1 $handle $host
  return 0
  }
#Abo
if {[string match {chanrem} $hitkey] == 1} {
  remchan $nick $chan $otbn1 $handle $host
  return 0
  }
#ABo - not work, probably conflicting with another script
#if {[string match {part} $hitkey] == 1} {
#  remchan $nick $chan $otbn1 $handle $host
#  return 0
#  }
#Abo
if {[string match {chandel} $hitkey] == 1} {
  remchan $nick $chan $otbn1 $handle $host
  return 0
  }
#AbO
if {[string match {global} $hitkey] == 1} {
  broadcast $nick $host $botnet
  return 0
  }
if {[string match {broadcast} $hitkey] == 1} {
  broadcast $nick $host $botnet
  return 0
  }
#AbO
if {[string match {suspend} $hitkey] == 1} {
  disable $nick $handle $host $chan $otbn1
  return 0
  }
if {[string match {disable} $hitkey] == 1} {
  disable $nick $handle $host $chan $otbn1
  return 0
  }
#AbO
if {[string match {unsuspend} $hitkey] == 1} {
  enable $nick $host $chan $otbn1
  return 0
  }
if {[string match {enable} $hitkey] == 1} {
  enable $nick $host $chan $otbn1
  return 0
  }
if {![matchattr $handle m]} {
  putserv "NOTICE $nick :Permission Denied."
  return 0
  }
if {[string match {save} $hitkey] == 1} {
  do_save $nick $host
  return 0	
  } 
if {[string match {rehash} $hitkey] == 1} {
  do_rehash $nick $host
  return 0
  }
if {[string match {restart} $hitkey] == 1} {
  do_restart $nick $host 
  return 0
  }
#AbO
if {[string match {sendmsg} $hitkey] == 1} {
  sndmsg $nick $otbn1 $host $botnet2
  return 0
  }
if {[string match {sndmsg} $hitkey] == 1} {
  sndmsg $nick $otbn1 $host $botnet2
  return 0
  }
#AbO
if {[string match {sendnotice} $hitkey] == 1} {
  sndnotice $nick $otbn1 $host $botnet2
  return 0
  }
if {[string match {sndnotice} $hitkey] == 1} {
  sndnotice $nick $otbn1 $host $botnet2
  return 0
  }
if {[string match {servers} $hitkey] == 1} {
  servers $nick $host
  return 0
  }
if {![matchattr $handle n]} {
  putserv "NOTICE $nick :Permission Denied."
  return 0
  }
#AbO
if {[string match {shutdown} $hitkey] == 1} {
  core $nick $host $handle 
  return 0
  }
#AbO
if {[string match {die} $hitkey] == 1} {
  core $nick $host $handle 
  return 0
  }
if {[string match {core} $hitkey] == 1} {
  core $nick $host $handle 
  return 0
  }
# added by |nsid3r
if {[string match {onjoin} $hitkey] == 1} {
  bot-onjoin_tcl $nick $host $handle $chan $arg
  return 0
  }
  }


